﻿using Blm.RabbitMQ.MessageQueue;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using VisionCloud.Domain.Common;
using VisionCloud.Domain.DtoModel.Inner;
using VisionCloud.Domain.Filters;

namespace VisionCloud.Api.Controllers.Inner
{
    [SystemModule("平板端日志")]
    [ApiVersion("1.0")]
    [Route("api/inner/SurfaceLog/[Action]")]
    [ApiExplorerSettings(GroupName = "平板端日志")]
    public class SurfaceLogController : ApiBaseController
    {
        private readonly IRabbitMQProducer rabbitMQProducer;

        public SurfaceLogController(IRabbitMQProducer rabbitMQProducer)
        {
            this.rabbitMQProducer = rabbitMQProducer;
        }

        /// <summary>
        /// 新增平板端日志
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [AllowAnonymous, HttpPost]
        public async Task<ApiResult> Add([FromBody] SurfaceLogAddDto dto)
        {
            await rabbitMQProducer.SendAsync(dto);

            return new ApiResult { Code = AjaxCode.Success, Message = "Success" };
        }
    }
}
